package www.com.zhongge.heap;

/**
 * @ClassName TestHeap
 * @Description TODO 堆的测试类
 * @Author 笨忠
 * @Date 2025/7/30 11:25
 * @Version 1.0
 */
@SuppressWarnings("all")
public class TestHeap {
    public static void main(String[] args) {
        int[] arr = {27, 15, 19, 18, 28, 34, 65, 49, 25, 37};
        MyHeap myHeap = new MyHeap();
        myHeap.initBintry(arr);
        System.out.println("===========完全二叉树============");
        myHeap.disply();

        myHeap.createBigRootHeap();//创建大根堆
        System.out.println("===========大根堆============");
        myHeap.disply();

        myHeap.offer(80);
        System.out.println("===========插入80后的大根堆============");
        myHeap.disply();

        System.out.println("==============删除80===============");
        System.out.println(myHeap.poll());
        System.out.println("===========删除80后的大根堆============");
        myHeap.disply();

        System.out.println("==============获取堆顶元素===============");
        myHeap.peek();
    }
}
